<?php
class CMS_Controller_Action_Public extends CMS_Controller_Action
{
    const ABOUT_US = 17;
    const SERVICES = 18;
    const SOLUTIONS = 19;
    const CAREERS = 20;
  
  	public function init()
	{
		parent::init();
		$this->view->web = $this->setMetas();
		$this->view->lang = Common_Translate::getLanguage();
		$this->view->langs = $this->setLangsUrls();
		$this->view->news = $this->setLatestNews();
		$this->setUrlsMenu();
	}	
	
    private function setLatestNews()
	{
	  $news = new CMS_Models_LangNews();
	  return $news->getNewsByLang(Common_Translate::getLanguage(),"publish_date desc",0,3);
	}
	
	private function setUrlsMenu()
	{
	  $content = new Zend_Models_LangContent();
	  $this->view->urlAbout = $content->getContentUrl(self::ABOUT_US, Common_Translate::getLanguage());
	  $this->view->urlServices = $content->getContentUrl(self::SERVICES, Common_Translate::getLanguage());
	  $this->view->urlSolutions = $content->getContentUrl(self::SOLUTIONS, Common_Translate::getLanguage());
	  $this->view->urlCareers = $content->getContentUrl(self::CAREERS, Common_Translate::getLanguage());
	}
	
	private function setMetas()
	{
	  $web = new CMS_Models_LangWeb();
	  $web = $web->getWebByKey(1,Common_Translate::getLanguage());
	  return $web;
	}
	
	private function setLangsUrls()
	{
	  $langs = new CMS_Models_Lang();
	  return $langs->getEnabledLangs();
	}
	

}